summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-11-30 17:52:03 +0100
committerGitHub <noreply@github.com>2023-11-30 17:52:03 +0100
commit3c45ba1c2213b9f23dc90e53d840f626d241f537 (patch)
treef09b1f3a4c07ffdd1ba36ad6993a3220c5fbdf0b
parentMerge pull request #12229 from liamwhite/qcom-wtf (diff)
parentcmake: prefer system gamemode library (diff)
downloadyuzu-3c45ba1c2213b9f23dc90e53d840f626d241f537.tar
yuzu-3c45ba1c2213b9f23dc90e53d840f626d241f537.tar.gz
yuzu-3c45ba1c2213b9f23dc90e53d840f626d241f537.tar.bz2
yuzu-3c45ba1c2213b9f23dc90e53d840f626d241f537.tar.lz
yuzu-3c45ba1c2213b9f23dc90e53d840f626d241f537.tar.xz
yuzu-3c45ba1c2213b9f23dc90e53d840f626d241f537.tar.zst
yuzu-3c45ba1c2213b9f23dc90e53d840f626d241f537.zip
-rw-r--r--.reuse/dep54
-rw-r--r--CMakeLists.txt4
-rw-r--r--CMakeModules/Findgamemode.cmake15
-rw-r--r--externals/CMakeLists.txt6
-rw-r--r--externals/gamemode/CMakeLists.txt11
-rw-r--r--externals/gamemode/gamemode_client.h (renamed from externals/gamemode/include/gamemode_client.h)3
-rw-r--r--src/common/CMakeLists.txt2
-rw-r--r--src/yuzu/CMakeLists.txt2
8 files changed, 29 insertions, 18 deletions
diff --git a/.reuse/dep5 b/.reuse/dep5
index d682fbdba..d98b78087 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -151,3 +151,7 @@ License: GPL-3.0-or-later
Files: externals/stb/*
Copyright: Sean Barrett
License: MIT
+
+Files: externals/gamemode/*
+Copyright: Copyright 2017-2019 Feral Interactive
+License: BSD-3-Clause
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 599f7c831..18b8f7967 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -343,6 +343,10 @@ if(ENABLE_OPENSSL)
find_package(OpenSSL 1.1.1 REQUIRED)
endif()
+if (UNIX AND NOT APPLE)
+ find_package(gamemode 1.7 MODULE)
+endif()
+
# Please consider this as a stub
if(ENABLE_QT6 AND Qt6_LOCATION)
list(APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}")
diff --git a/CMakeModules/Findgamemode.cmake b/CMakeModules/Findgamemode.cmake
new file mode 100644
index 000000000..aa2f36683
--- /dev/null
+++ b/CMakeModules/Findgamemode.cmake
@@ -0,0 +1,15 @@
+# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+find_package(PkgConfig QUIET)
+pkg_search_module(GAMEMODE QUIET IMPORTED_TARGET gamemode)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(gamemode
+ REQUIRED_VARS GAMEMODE_INCLUDEDIR
+ VERSION_VAR GAMEMODE_VERSION
+)
+
+if (gamemode_FOUND AND NOT TARGET gamemode::headers)
+ add_library(gamemode::headers ALIAS PkgConfig::GAMEMODE)
+endif()
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 04007a538..407c5c640 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -193,8 +193,10 @@ if (ANDROID)
endif()
endif()
-if (UNIX AND NOT APPLE)
- add_subdirectory(gamemode)
+if (UNIX AND NOT APPLE AND NOT TARGET gamemode::headers)
+ add_library(gamemode INTERFACE)
+ target_include_directories(gamemode INTERFACE gamemode)
+ add_library(gamemode::headers ALIAS gamemode)
endif()
# Breakpad
diff --git a/externals/gamemode/CMakeLists.txt b/externals/gamemode/CMakeLists.txt
deleted file mode 100644
index 87095642e..000000000
--- a/externals/gamemode/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-project(gamemode LANGUAGES CXX C)
-
-add_library(gamemode include/gamemode_client.h)
-
-target_link_libraries(gamemode PRIVATE common)
-
-target_include_directories(gamemode PUBLIC include)
-set_target_properties(gamemode PROPERTIES LINKER_LANGUAGE C)
diff --git a/externals/gamemode/include/gamemode_client.h b/externals/gamemode/gamemode_client.h
index 184812334..b9f64fe46 100644
--- a/externals/gamemode/include/gamemode_client.h
+++ b/externals/gamemode/gamemode_client.h
@@ -1,6 +1,3 @@
-// SPDX-FileCopyrightText: Copyright 2017-2019 Feral Interactive
-// SPDX-License-Identifier: BSD-3-Clause
-
/*
Copyright (c) 2017-2019, Feral Interactive
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 2c6fc7657..b58a7073f 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -188,7 +188,7 @@ if (UNIX AND NOT APPLE)
linux/gamemode.h
)
- target_link_libraries(common PRIVATE gamemode)
+ target_link_libraries(common PRIVATE gamemode::headers)
endif()
if(ARCHITECTURE_x86_64)
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index f3ad2214b..90278052a 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -386,7 +386,7 @@ if (NOT WIN32)
target_include_directories(yuzu PRIVATE ${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS})
endif()
if (UNIX AND NOT APPLE)
- target_link_libraries(yuzu PRIVATE Qt${QT_MAJOR_VERSION}::DBus gamemode)
+ target_link_libraries(yuzu PRIVATE Qt${QT_MAJOR_VERSION}::DBus)
endif()
target_compile_definitions(yuzu PRIVATE